#coding:utf-8

import datetime

from .Normalization import FuzzData
from FuzzCore.boofuzz import *
from FuzzCore.pyZZUF.pyZZUF import *
#from FuzzCore.wfuzz.wfuzz import *


class FuzzBaseClass():
    def __init__(self):
        self.host_ = ""
        self.port_ = 0
        self.proto_ = ""
        self.session_ = None


    def FuzzStart(self,fuzz_info = {}):
        raise NotImplementedError


    def Run(self,fuzz_info,process_name):
        self.host_ = fuzz_info['host']
        self.port_ = fuzz_info['port']
        self.proto_ = fuzz_info['proto']

        if fuzz_info['core'] == "wfuzz":
            wfuzz_commend = "-X %s -z %s,%s -H %s -u %s"

        elif fuzz_info['core'] == "boofuzz":

            def __setSession__(self):
                timestamp = datetime.datetime.utcnow().replace(microsecond=0).isoformat().replace(':', '-')

                connection = SocketConnection(self.host_, self.port_, proto=self.proto_, name=(timestamp,process_name))
                target = Target(connection=connection)
                self.session_ = Session(target=target, fuzz_name=timestamp)

            __setSession__()

            #self.FuzzStart(fuzz_info)

            self.session_.fuzz()

        else:
            pass



